# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=libcoap
pkgver=4.3.4a
pkgrel=0
pkgdesc="A CoAP (RFC 7252) implementation"
url="https://libcoap.net/"
arch="all"
license="BSD-2-Clause"
makedepends="automake autoconf libtool asciidoc openssl-dev>3 cunit-dev"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/obgm/libcoap/archive/v$pkgver.tar.gz"

build() {
	./autogen.sh
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--with-openssl \
		--disable-doxygen \
		--enable-tests
	make
}

check() {
	./tests/testdriver
}

package() {
	make DESTDIR="$pkgdir" install

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname
	install -m644 CONTRIBUTE AUTHORS ChangeLog NEWS README.md TODO \
		"$pkgdir"/usr/share/doc/$pkgname
}

sha512sums="
599a3b973e0a07574e36829e1ee4bcac4da385208ecefdb54df1a604f8f650d3041d246c24598e0215d3df262473b360d1db749a02f0c6bafaaf7a49dd90aee2  libcoap-4.3.4a.tar.gz
"
